package Atop100;

public class HuiWen {

    public  String  find(String s){
        String ans="";
        for (int i = 0; i < s.length(); i++) {
            String s1 = judgeHuiWen(s, i, i);
            String s2 = judgeHuiWen(s, i, i + 1);
            ans=s1.length()>ans.length()?s1:ans;
            ans=s2.length()>ans.length()?s2:ans;
        }

        return ans;
    }

    public  String   judgeHuiWen(String s,int left,int right){
        int len= s.length();
        while (left>=0&&right<len&&s.charAt(left)==s.charAt(right)){
            left--;
            right++;
        }
        return  s.substring(left+1,right);
    }



}
